package com.xdwanj.servlet;

import com.xdwanj.common.R;
import com.xdwanj.service.ClassInfoService;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @date ：Created in 2024/4/28 0:03
 */
@Component
@WebServlet(name = "ClassInfoServlet", urlPatterns = "/classInfo")
public class ClassInfoServlet extends BaseServlet {

    // 创建业务层
    @Autowired
    private ClassInfoService classInfoService;

    /**
     * 获取图书类型列表
     *
     * @param request  请求对象
     * @param response 响应对象
     * @return list
     */

    public R<List<Map<String, Object>>> getList(HttpServletRequest request, HttpServletResponse response) {
        List<Map<String, Object>> list = classInfoService.getList();
        return R.success(list);
    }
}